// MESSAGE ASCTEC_HEARTBEAT PACKING

#define MAVLINK_MSG_ID_ASCTEC_HEARTBEAT 0

typedef struct __mavlink_asctec_heartbeat_t
{
 uint32_t msec; ///< Timestamp
 uint16_t cpu_load; ///< CPU load (should be 1000)
 uint8_t sdk_status; ///< SDK Status
 uint8_t control_mode; ///<  control mode 
 uint8_t publishing_mode; ///<  publishing mode 
} mavlink_asctec_heartbeat_t;

#define MAVLINK_MSG_ID_ASCTEC_HEARTBEAT_LEN 9
#define MAVLINK_MSG_ID_0_LEN 9



#define MAVLINK_MESSAGE_INFO_ASCTEC_HEARTBEAT { \
	"ASCTEC_HEARTBEAT", \
	5, \
	{  { "msec", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_asctec_heartbeat_t, msec) }, \
         { "cpu_load", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_asctec_heartbeat_t, cpu_load) }, \
         { "sdk_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_asctec_heartbeat_t, sdk_status) }, \
         { "control_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_asctec_heartbeat_t, control_mode) }, \
         { "publishing_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_asctec_heartbeat_t, publishing_mode) }, \
         } \
}


/**
 * @brief Pack a asctec_heartbeat message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param msec Timestamp
 * @param sdk_status SDK Status
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param cpu_load CPU load (should be 1000)
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       uint32_t msec, uint8_t sdk_status, uint8_t control_mode, uint8_t publishing_mode, uint16_t cpu_load)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[9];
	_mav_put_uint32_t(buf, 0, msec);
	_mav_put_uint16_t(buf, 4, cpu_load);
	_mav_put_uint8_t(buf, 6, sdk_status);
	_mav_put_uint8_t(buf, 7, control_mode);
	_mav_put_uint8_t(buf, 8, publishing_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 9);
#else
	mavlink_asctec_heartbeat_t packet;
	packet.msec = msec;
	packet.cpu_load = cpu_load;
	packet.sdk_status = sdk_status;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 9);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_HEARTBEAT;
	return mavlink_finalize_message(msg, system_id, component_id, 9, 252);
}

/**
 * @brief Pack a asctec_heartbeat message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message was sent over
 * @param msg The MAVLink message to compress the data into
 * @param msec Timestamp
 * @param sdk_status SDK Status
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param cpu_load CPU load (should be 1000)
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           uint32_t msec,uint8_t sdk_status,uint8_t control_mode,uint8_t publishing_mode,uint16_t cpu_load)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[9];
	_mav_put_uint32_t(buf, 0, msec);
	_mav_put_uint16_t(buf, 4, cpu_load);
	_mav_put_uint8_t(buf, 6, sdk_status);
	_mav_put_uint8_t(buf, 7, control_mode);
	_mav_put_uint8_t(buf, 8, publishing_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 9);
#else
	mavlink_asctec_heartbeat_t packet;
	packet.msec = msec;
	packet.cpu_load = cpu_load;
	packet.sdk_status = sdk_status;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 9);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_HEARTBEAT;
	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 9, 252);
}

/**
 * @brief Encode a asctec_heartbeat struct into a message
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param asctec_heartbeat C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_asctec_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asctec_heartbeat_t* asctec_heartbeat)
{
	return mavlink_msg_asctec_heartbeat_pack(system_id, component_id, msg, asctec_heartbeat->msec, asctec_heartbeat->sdk_status, asctec_heartbeat->control_mode, asctec_heartbeat->publishing_mode, asctec_heartbeat->cpu_load);
}

/**
 * @brief Send a asctec_heartbeat message
 * @param chan MAVLink channel to send the message
 *
 * @param msec Timestamp
 * @param sdk_status SDK Status
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param cpu_load CPU load (should be 1000)
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_asctec_heartbeat_send(mavlink_channel_t chan, uint32_t msec, uint8_t sdk_status, uint8_t control_mode, uint8_t publishing_mode, uint16_t cpu_load)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[9];
	_mav_put_uint32_t(buf, 0, msec);
	_mav_put_uint16_t(buf, 4, cpu_load);
	_mav_put_uint8_t(buf, 6, sdk_status);
	_mav_put_uint8_t(buf, 7, control_mode);
	_mav_put_uint8_t(buf, 8, publishing_mode);

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_HEARTBEAT, buf, 9, 252);
#else
	mavlink_asctec_heartbeat_t packet;
	packet.msec = msec;
	packet.cpu_load = cpu_load;
	packet.sdk_status = sdk_status;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_HEARTBEAT, (const char *)&packet, 9, 252);
#endif
}

#endif

// MESSAGE ASCTEC_HEARTBEAT UNPACKING


/**
 * @brief Get field msec from asctec_heartbeat message
 *
 * @return Timestamp
 */
static inline uint32_t mavlink_msg_asctec_heartbeat_get_msec(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field sdk_status from asctec_heartbeat message
 *
 * @return SDK Status
 */
static inline uint8_t mavlink_msg_asctec_heartbeat_get_sdk_status(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint8_t(msg,  6);
}

/**
 * @brief Get field control_mode from asctec_heartbeat message
 *
 * @return  control mode 
 */
static inline uint8_t mavlink_msg_asctec_heartbeat_get_control_mode(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint8_t(msg,  7);
}

/**
 * @brief Get field publishing_mode from asctec_heartbeat message
 *
 * @return  publishing mode 
 */
static inline uint8_t mavlink_msg_asctec_heartbeat_get_publishing_mode(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint8_t(msg,  8);
}

/**
 * @brief Get field cpu_load from asctec_heartbeat message
 *
 * @return CPU load (should be 1000)
 */
static inline uint16_t mavlink_msg_asctec_heartbeat_get_cpu_load(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint16_t(msg,  4);
}

/**
 * @brief Decode a asctec_heartbeat message into a struct
 *
 * @param msg The message to decode
 * @param asctec_heartbeat C-struct to decode the message contents into
 */
static inline void mavlink_msg_asctec_heartbeat_decode(const mavlink_message_t* msg, mavlink_asctec_heartbeat_t* asctec_heartbeat)
{
#if MAVLINK_NEED_BYTE_SWAP
	asctec_heartbeat->msec = mavlink_msg_asctec_heartbeat_get_msec(msg);
	asctec_heartbeat->cpu_load = mavlink_msg_asctec_heartbeat_get_cpu_load(msg);
	asctec_heartbeat->sdk_status = mavlink_msg_asctec_heartbeat_get_sdk_status(msg);
	asctec_heartbeat->control_mode = mavlink_msg_asctec_heartbeat_get_control_mode(msg);
	asctec_heartbeat->publishing_mode = mavlink_msg_asctec_heartbeat_get_publishing_mode(msg);
#else
	memcpy(asctec_heartbeat, _MAV_PAYLOAD(msg), 9);
#endif
}
